package net.stogi.common.gwt.dispatch.server.core;

import net.stogi.common.gwt.dispatch.shared.core.Action;
import net.stogi.common.gwt.dispatch.shared.core.Result;
import net.stogi.common.gwt.dispatch.shared.exception.ActionException;

public interface Dispatch<A extends Action<R>, R extends Result> {

	/**
	 * Executes the specified action and returns the appropriate result.
	 * 
	 * @param <T>
	 *            The {@link Result} type.
	 * @param action
	 *            The {@link Action}.
	 * @return The action's result.
	 * @throws ActionException
	 *             If the action execution failed.
	 */
	R execute(A action) throws ActionException;
}
